package com.wondertek.poms.dao.po;

import javax.persistence.*;

import com.wondertek.poms.common.constant.CurrentUser;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.Proxy;
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;

import lombok.Data;

/**
 * <p><b>SyncTask Description:</b> SyncTask po类 ;  </p>
 * @author 窦再兴
 * <p><b>DATE</b> 2020-10-21 13:50:43</p>
 */
@Data
@Entity
@Table(name = "sync_task")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SyncTask implements java.io.Serializable {

	private static final long serialVersionUID = 3501049503981481054L;

	// 同步任务消息记录状态
	/*public static Long SYNC_ATTRIBUTE_TASK_STATUS_PROCESSING = new Long(1); // 处理中
	public static Long SYNC_ATTRIBUTE_TASK_STATUS_SUCCESSEND = new Long(2); // 处理成功
	public static Long SYNC_ATTRIBUTE_TASK_STATUS_FAILUREEND = new Long(3); // 处理失败

	public static String SYNC_NOTIFYTYPE_PRODUCTUNIT = "000";
	public static String SYNC_NOTIFYTYPE_RELEATION = "001";
	public static String SYNC_NOTIFYTYPE_CONTENT = "002";
	public static String SYNC_NOTIFYTYPE_LOOPBROADCAST = "003";
	public static String SYNC_NOTIFYTYPE_CP = "004";*/


	/**
	 * <b>Fields</b> id : id
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SYNCTASK_SEQ")
	@SequenceGenerator(name = "SYNCTASK_SEQ", allocationSize = 1, sequenceName = "SYNCTASK_SEQ")
	private Long id;
	
	/**
	 * <b>Fields</b> accessId : ACCESS_ID
	 */
	@Column(name = "access_id")
	private String accessId;
	
	/**
	 * <b>Fields</b> accessPlatformId : 
	 */
	@Column(name = "access_platform_id")
	private String accessPlatformId;
	
	/**
	 * <b>Fields</b> accessPlatformType : 
	 */
	@Column(name = "access_platform_type")
	private String accessPlatformType;
	
	/**
	 * <b>Fields</b> accessPwd : 
	 */
	@Column(name = "access_pwd")
	private String accessPwd;
	
	/**
	 * <b>Fields</b> accessSeq : 
	 */
	@Column(name = "access_seq")
	private String accessSeq;
	
	/**
	 * <b>Fields</b> accesstime : 
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private java.time.LocalDateTime accesstime;
	
	/**
	 * <b>Fields</b> actiontype : 
	 */
	private String actiontype;
	
	/**
	 * <b>Fields</b> basePath : 
	 */
	@Column(name = "base_path")
	private String basePath;
	
	/**
	 * <b>Fields</b> contentId : 
	 */
	@Column(name = "content_id")
	private String contentId;
	
	/**
	 * <b>Fields</b> cpId : 
	 */
	@Column(name = "cp_id")
	private String cpId;
	
	/**
	 * <b>Fields</b> distResult : 
	 */
	@Column(name = "dist_result")
	private String distResult;
	
	/**
	 * <b>Fields</b> endtime : 
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private java.time.LocalDateTime endtime;
	
	/**
	 * <b>Fields</b> failReason : 
	 */
	@Column(name = "fail_reason")
	private String failReason;
	
	/**
	 * <b>Fields</b> fileIds : 
	 */
	@Column(name = "file_ids")
	private String fileIds;
	
	/**
	 * <b>Fields</b> needBc : 
	 */
	@Column(name = "need_bc")
	private String needBc;
	
	/**
	 * <b>Fields</b> notifytype : 
	 */
	private String notifytype;
	
	/**
	 * <b>Fields</b> offlineStatus : 0：非下线操作，20：待下线，21：下线中，22：下线成功，23：下线失败
	 */
	@Column(name = "offline_status")
	private Integer offlineStatus;
	
	/**
	 * <b>Fields</b> oprCode : 1新增，2变更(不涉及媒体文件更新)，3删除，4变更(涉及媒体文件更新)
	 */
	@Column(name = "opr_code")
	private String oprCode;
	
	/**
	 * <b>Fields</b> oprTime : 
	 */
	@Column(name = "opr_time")
	private String oprTime;
	
	/**
	 * <b>Fields</b> priority : 
	 */
	private String priority;
	
	/**
	 * <b>Fields</b> remoteip : 
	 */
	private String remoteip;
	
	/**
	 * <b>Fields</b> respTime : 
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "resp_time")
	private java.time.LocalDateTime respTime;
	
	/**
	 * <b>Fields</b> resultCode : 
	 */
	@Column(name = "result_code")
	private Integer resultCode;
	
	/**
	 * <b>Fields</b> resultdesc : 
	 */
	private String resultdesc;
	
	/**
	 * <b>Fields</b> servType : 
	 */
	@Column(name = "serv_type")
	private String servType;
	
	/**
	 * <b>Fields</b> starttime : 
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private java.time.LocalDateTime starttime;
	
	/**
	 * <b>Fields</b> status : 任务状态；1处理中 2成功；3失败
	 */
	private Integer status;
	
	/**
	 * <b>Fields</b> syncMode : 
	 */
	@Column(name = "sync_mode")
	private Integer syncMode;
	
	/**
	 * <b>Fields</b> syncTime : 
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "sync_time")
	private java.time.LocalDateTime syncTime;
	
	/**
	 * <b>Fields</b> updateFields : 
	 */
	@Column(name = "update_fields")
	private String updateFields;
	
	/**
	 * <b>Fields</b> version : 
	 */
	private String version;

	/**
	 * <b>Fields</b> lastModifyTime : 转图需要的最终修改时间，数据出自上游系统 ModifyTime
	 */
	@Transient
	private String lastModifyTime;
	
	/**
	 * <b>Fields</b> success : 转图状态 true 成功 false 失败  默认成功
	 */
	@Transient
	private Boolean success = true;

	@Transient
	private String assetId;

	@Transient
	private String fromDate;

	@Transient
	private String toDate;
	
	/*public static void putTimeAndUser(SyncTask syncTask) {
		if (syncTask.id == null) {
			syncTask.setCreatedBy(CurrentUser.currUserName());
			syncTask.setCreatedTime(java.time.LocalDateTime.now());
		}
		syncTask.setUpdatedBy("1");
		syncTask.setUpdatedTime(java.time.LocalDateTime.now());
	}*/
}